﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using Domain.Common;
using Domain.Setup.Entities;
using Domain.StudyDefinition.Entities;
using Domain.Scheduling.Entities;
using System.Data.Objects;
using Domain.UserManagement.Entities;

namespace Infrastructure.Common.Data
{
    /// <summary>
    /// Database context for the VPL Application.
    /// </summary>
    public class Context : DbContext, Infrastructure.Common.Data.IContext, IUnitOfWork
    {
        /// <summary>
        /// Gets or sets the skills Database set.
        /// </summary>
        /// <value>
        /// The skills Database set.
        /// </value>
        public DbSet<Skill> Skills { get; set; }

        /// <summary>
        /// Gets or sets the tasks Database set.
        /// </summary>
        /// <value>
        /// The tasks Database set.
        /// </value>
        public DbSet<Task> Tasks { get; set; }

        /// <summary>
        /// Gets or sets the scheduled tasks Database set.
        /// </summary>
        /// <value>
        /// The scheduled tasks Database set.
        /// </value>
        public DbSet<PlannedTask> PlannedTasks { get; set; }

        /// <summary>
        /// Gets or sets the studies Database set.
        /// </summary>
        /// <value>
        /// The studies Database set.
        /// </value>
        public DbSet<Study> Studies { get; set; }

        /// <summary>
        /// Gets or sets the subjects Database set.
        /// </summary>
        /// <value>
        /// The subjects Database set.
        /// </value>
        public DbSet<Subject> Subjects { get; set; }

        /// <summary>
        /// Gets or sets the subject groups Database set.
        /// </summary>
        /// <value>
        /// The subject groups Database set.
        /// </value>
        public DbSet<SubjectGroup> SubjectGroups { get; set; }

        /// <summary>
        /// Gets or sets the treatments Database set.
        /// </summary>
        /// <value>
        /// The treatments Database set.
        /// </value>
        public DbSet<Treatment> Treatments { get; set; }

        /// <summary>
        /// Gets or sets the users Database set.
        /// </summary> 
        /// <value>
        /// The users Database set.
        /// </value>
        public DbSet<User> Users { get; set; }

        /// <summary>
        /// Gets or sets the roles Database set.
        /// </summary>
        /// <value>
        /// The roles Database set.
        /// </value>
        public DbSet<Role> Roles { get; set; }

        /// <summary>
        /// Gets or sets the schedule studys Database set.
        /// </summary>
        /// <value>
        /// The schedule studys Database set.
        /// </value>
        public DbSet<ScheduleStudy> ScheduleStudys { get; set; }

        /// <summary>
        /// Saves all the work performed since the last commit or roll back.
        /// </summary>
        public void Save()
        {
            this.SaveChanges();
        }
    }
}
